package section2;

import java.util.Scanner;
public class PracticeVII {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a;
		while(sc.hasNext()){
			a = sc.nextInt();
			if(a==0)
				break;
			System.out.println(Integer.lowestOneBit(a));
		}
	}
}
/*
Lowest Bit

Sample Input
26
88
0
Sample Output
2
8

 * */






